﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pata.SylkSharp.Core.Bll
{
    /// <summary>
    /// Represent a field of a record.
    /// </summary>
    /// <typeparam name="T">An enum representing the fields made for the record.</typeparam>
    public abstract class FieldBase<T> : IField where T : struct
    {
        /// <summary>
        /// Represent the type of this field.
        /// </summary>
        public T Type { get; set; }

        /// <summary>
        /// Instanciate a new FieldBase
        /// </summary>
        /// <param name="pType"></param>
        /// <param name="pValue"></param>
        public FieldBase(T pType, string pValue)
        {
            this.Type = pType;
            this.Value = pValue;
        }

        /// <summary>
        /// Get or set the value of this Field.
        /// </summary>
        public string Value { get; set; }

        object IField.Type
        {
            get { return this.Type; }
        }
    }
}
